package com.webmarmun;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.Toast;
import android.widget.AdapterView.OnItemSelectedListener;


public class First extends Activity{
	private String array_spinner[];
	
	@Override
	public void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		ImageView image = (ImageView) findViewById(R.id.test_image);
		array_spinner=new String[6];
        array_spinner[0]="Izaberite neku od opcija";
        array_spinner[1]="Uverenja";
        array_spinner[2]="Zatezne kamate";
        array_spinner[3]="Baza veštaka";
        array_spinner[4]="Baza tumača";
        array_spinner[5]="Zakazivanje razgledanja spisa";
        final Spinner s = (Spinner) findViewById(R.id.Spinner01);
       
       ArrayAdapter adapter = new ArrayAdapter(this,android.R.layout.simple_spinner_item, array_spinner);
       
      
        s.setAdapter(adapter);
		 DisplayMetrics d = new DisplayMetrics(); 
		  getWindow().getWindowManager().getDefaultDisplay().getMetrics(d); 
		 int wdt=  d.widthPixels;
		  s.getLayoutParams().width=wdt;
		  
		  
		  final int iCurrentSelection = s.getSelectedItemPosition();
		  s.setOnItemSelectedListener(new OnItemSelectedListener()
	        {

	            @Override
	            public void onItemSelected(AdapterView<?> arg0, View arg1,
	                    int arg2, long arg3) {
	                // TODO Auto-generated method stub
	                switch (arg2) {
	                case 0:                 
	                	                       
	                    break;

	                case 1:                 
	                	Intent myIntent1 = new Intent(First.this, AndredActivity.class);
		  		          First.this.startActivity(myIntent1);                      
	                    break;
	                    
	                case 2:                 
	                	Intent myIntent2 = new Intent(First.this, AndredActivity.class);
		  		          First.this.startActivity(myIntent2);                      
	                    break;
	                case 3:                 
	                	Intent myIntent3 = new Intent(First.this, AndredActivity.class);
		  		          First.this.startActivity(myIntent3);                      
	                    break;
	                    
	                case 4:                 
	                	Intent myIntent4 = new Intent(First.this, AndredActivity.class);
		  		          First.this.startActivity(myIntent4);                      
	                    break;

	                default :                       
	                    break;
	                }
	            }

	            @Override
	            public void onNothingSelected(AdapterView<?> arg0) {
	                // TODO Auto-generated method stub

	            }

	        });

		  
		  System.out.print(iCurrentSelection);
		  
}

		
	

}
